package com.kzw.oa.byxt.service;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.kzw.core.service.hibernate.DefaultEntityManager;
import com.kzw.core.util.ContextUtil;
import com.kzw.oa.byxt.model.SubjectOpinion;
import com.kzw.oa.model.system.AppUser;

@Service
@Transactional
public class SubjectOpinionService extends DefaultEntityManager<SubjectOpinion, Long> {

	/**
	 * 保存流程信息
	 * */
	public void saveOpinion(Long subjectId, String name, boolean pass, String msg) {
		// 流程信息
		AppUser currUser = ContextUtil.getCurrentUser();
		SubjectOpinion opinion = new SubjectOpinion();
		opinion.setName(name);
		opinion.setCheckDept(currUser.getDepartment());
		opinion.setCheckUser(currUser);
		opinion.setPass(pass?1:0);
		opinion.setSubjectId(subjectId);
		opinion.setOpinion(msg);
		saveOrUpdate(opinion);
	}
}
